<?php
namespace app\home\controller;

use app\common\HomeBase;
use think\facade\Request;
use think\Db;
/**
 * @title 游戏大厅
 * @description 接口说明
 * @group 樱桃荟
 * @param name:token type:string require:1 default:无 other: desc:验证
 */
class GameHall extends HomeBase
{
	/**
     * @title 游戏大厅展示
     * @author 雪飞鸟
     * @description data：[扫雷=>[[房间id、房间名称、规则、赔率、类型],],接龙=>[[房间id、房间名称、规则、赔率、类型],]]
     * @url /home/GameHall/index
     * @method GET
     * @return sList:扫雷列表@
     * @sList room_id:1 room_name:新手房一 gold_range:10--30 odds:1.5 type:1
     * @return fList:接龙列表@
     * @fList room_id:1 room_name:新手房一 gold_range:10币5包 odds:0.0 type:2
     */
    public function index()
    {
        $user 		= $this->user;
        $sList 		= db('room')->where(['type' => 1])->select();
        $fList		= db('room')->where(['type' => 2])->select();
        $arr['sList']	= $sList;
        $arr['fList'] 	= $fList;
        return json_success($arr);
    }

    /**
     * @title 房间信息
     * @author 雪飞鸟
     * @url /home/GameHall/roomInfo
     * @method GET
     * @param name:roomId type:Int require:1 default: other: desc:房间id
     */
    public function roomInfo()
    {
        $id = Request::param('roomId');
        $roomInfo = Db::name('room')->where('room_id',$id)->find();
        if ($roomInfo) 
        {
            return json_success(['pocks' => $roomInfo['pocket']]);
        }
        else
        {
            return json_error('房间信息不存在');
        }
    }
}
